Scripted run

From CGSecurity

Jump to: navigation, search

TestDisk and PhotoRec can run automatically using their own built-in commands. A script file (such as .cmd or .bat 'Batch files' under MS-DOS/Windows, or some shell under Linux) may also be helpful.

This document describes the command line syntax.

Contents

TestDisk

Syntax: testdisk /cmd device cmd

Device selection

Use the device name, ie /dev/hda, /dev/hdb, /dev/sda.
For DOS version, use /dev/sda128 for first disk, /dev/sda129 for the second and so on...

Partition type selection

  • partition_i386
  • partition_mac
  • partition_none
  • partition_sun
  • partition_xbox

Main menu

  • advanced
  • analyze
  • delete
  • geometry
  • mbr_code
  • options
  • list

Analyse menu

  • backup
  • mode_vista: search for partitions created by Windows Vista Disk Manager
  • list
  • search
  • noconfirm
  • write

Advanced menu

  • type
  • boot
  • superblock
  • number: the partition number to select

FAT1x menu

  • rebuildbs
  • dump
  • repairfat
  • initroot

FAT32 menu

  • rebuildbs
  • dump
  • repairfat
  • originalfat
  • backupfat

FAT rebuild menu

  • list
  • dump

NTFS menu

  • rebuildbs
  • dump
  • originalntfs
  • backupntfs
  • repairmft

NTFS rebuild menu

  • list
  • dump

Geometry menu

  • C,number of cylinders
  • H,number of heads
  • S,number of sectors
  • N,sector size

Some examples

testdisk /debug /log /cmd /dev/hda analyze,search

testdisk /debug /log /cmd partition.dd options,partition_none,geometry,H,32,analyze,list,advanced,boot,rebuildbs,
list partition.dd

PhotoRec

Syntax: photorec /cmd device cmd

Partition type selection

  • partition_i386
  • partition_mac
  • partition_none
  • partition_sun
  • partition_xbox

Main menu

  • number: the partition number to select
  • search
  • options

Options menu

  • mode_ext2

Some examples

photorec /debug /log /cmd /dev/hdb partition_i386,select,search
photorec /debug /log /cmd /dev/hda partition_i386,options,mode_ext2,5,search
Data Recovery